﻿using System;

namespace Hopscotch.Common.Logging
{
    public class AppLogger : ILogger
    {
        //Use NLog's Logger internally
        protected readonly NLog.Logger logger;

        protected AppLogger(NLog.Logger logger)
        {
            this.logger = logger;
        }

        public static ILogger CreateLogger<T>()
        {
            return CreateLogger(typeof(T).Name);
        }

        public static ILogger CreateLogger(string name)
        {
            return new AppLogger(NLog.LogManager.GetLogger(name));
        }

        public void Debug(string message)
        {
            logger.Debug(message);
        }

        public void Debug(string message, params object[] args)
        {
            logger.Debug(message, args);
        }

        public void Info(string message)
        {
            logger.Info(message);
        }

        public void Info(string message, params object[] args)
        {
            logger.Info(message, args);
        }

        public void Warning(string message)
        {
            logger.Warn(message);
        }

        public void Warning(string message, params object[] args)
        {
            logger.Info(message, args);
        }

        public void Error(string message)
        {
            logger.Error(message);
        }

        public void Error(string message, params object[] args)
        {
            logger.Error(message, args);
        }

        public void Error(string message, Exception exception)
        {
            logger.Error(message, exception);
        }

    }
}
